import request from "../../utils/reuqest";

interface GetOrdersParams {
    page: number;
    size: number;
    orderId?: string;
    phone?: string;
    state: number;
    username?: string;
}

interface GetOrdersRes {
    total: number;
    records: OrderInfoItem[];
    code: number;
    msg: string;
    data: GetOrdersData;
}

export interface GetOrdersData {
    total: number;
    records: OrderInfoItem[];
}

export interface OrderInfoItem {
    id: number;
    phone: string;
    goodId: number;
    num: number;
    address: string;
    createTime: string;
    username: string;
    userId: number;
    state: boolean;
    orderId: string;
    expressId: string | null;
    expressCompany: string | null;
}

// 获取订单列表
export function getOrders(params: GetOrdersParams): Promise<GetOrdersRes> {
    return request.post(`/admin/admin/getOrders`, params);
}

export type { GetOrdersParams };